package com.membership.cloud.web.model;

import com.membership.cloud.jpa.domain.StoreUser;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

/**
 * Created by hiephn on 2014/07/12.
 */
public class UserResponse extends NameDescResponse<StoreUser> {
    private String fullName;
    private String birthday;
    private String phone;

    public UserResponse() {
    }

    public UserResponse(int id, String name, String desc) {
        super(id, name, desc);
    }

    public UserResponse(StoreUser entity) {
        super(entity);
    }

    @Override
    public void setData(StoreUser entity) {
        super.setData(entity);
        this.fullName = entity.getFullName();
        this.phone = entity.getPhone();
        if (entity.getBirthday() != null) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
            sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
            this.birthday = sdf.format(new Date(entity.getBirthday().getTime()));
        }
    }

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }
}
